package com.interviewbackend.vo;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

@Data

public class ResultVO<T> {
    private Integer code;
    private String message;
    private T data;

    public ResultVO() {}

    public ResultVO(Integer code, String message, T data) {
        this.code = code;
        this.message = message;
        this.data = data;
    }


    public static <T> ResultVO<T> success(T data) {
        return new ResultVO<>(200, "success", data);
    }

    public static ResultVO<Void> success() {
        return new ResultVO<Void>(200, "success", null);

    }

    public static ResultVO<Void> error(String message) {
        return new ResultVO<Void>(500, message, null);
    }

}

